using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace CapstoneProject.Activities
{
    [Activity(Label = "Edit Account")]
    public class EditAccountActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.EditAccount);

            Button deleteButton = FindViewById<Button>(Resource.Id.DeleteButton);
            deleteButton.Click += DeleteAccount;
        }

        private void DeleteAccount(object sender, EventArgs e)
        {
            ((CapstoneApplication)Application).AccountRepository.DeleteAccount(Intent.GetIntExtra("Account", 0));

            Finish();

            Intent i = new Intent();
            i.SetClass(this, typeof(ProfileActivity));
            i.AddFlags(ActivityFlags.NewTask);
            i.PutExtra("User", Intent.GetStringExtra("User"));
            StartActivity(i);
        }
    }
}